package com.kt.appinfo.apinfo.servlet;

import com.kt.appinfo.apinfo.dao.DevUserMapper;
import com.kt.appinfo.apinfo.pojo.DevUser;
import lombok.extern.java.Log;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Log4j2
public class DevServletimpl implements DevServlet {
    @Autowired
    private DevUserMapper devUserMapper;

    @Override
    public DevUser dologin(String devCode, String devpassword) throws Exception {
        //1先根据用户名查询用户信息

        //2将查询出来1的用户数据与传递过来的密码进行对比
        DevUser devUser = devUserMapper.selectDevUserByDevCode(devCode);
        try {
            if (null != devUser) {
                if (devpassword.equals(devUser.getDevPassword())) {
                    return devUser;
                } else {
                    return null;
                }


            }

        } catch (Exception e) {
            log.info(e.getMessage(),e);
            throw  e;
        }
      return null;
    }
}


